﻿using System;
using Landpy.CruiseControlNet.ConfigurationSidekick.ConfigTreeModule;
using Landpy.CruiseControlNet.ConfigurationSidekick.ParserModule;

namespace Landpy.CruiseControlNet.ConfigurationSidekick.ConfigPropertyModule
{
    class XslFileHandler : GetPropertiesHandler
    {
        public override object GetPropertiesObject(GetPropertiesContext getPropertiesContext)
        {
            var treeNodeIndentity = this.GetTreeNodeIndentity(getPropertiesContext);
            if (treeNodeIndentity.Type == TreeNodeType.XslFile)
            {
                XslFileKey xslFileKey = XslFileKeyUtil.GetKey(treeNodeIndentity.Key);
                return this.XslFileRepository.GetXslFileById(getPropertiesContext.CruiseControl, xslFileKey.ProjectId,
                                                             xslFileKey.EmailId, xslFileKey.Id);
            }
            return this.Successor.GetPropertiesObject(getPropertiesContext);
        }


    }
}
